package com.liy.supercloud.ssoserver.job;

import com.liy.supercloud.ssoserver.service.RolePermissionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class PermissionJob {
    private static Logger log = LoggerFactory.getLogger(PermissionJob.class);

    @Autowired
    private RolePermissionService rolePermissionService;

    @Scheduled( fixedRate = 120000L )
    public void generateStationTicketDailyReport() {
        long s = System.currentTimeMillis();
        log.info("开始同步[自动]所有角色权限...." + System.currentTimeMillis());

        try {
            this.rolePermissionService.synSharePermissionToRedis("all");
            this.rolePermissionService.synRolePermissionToRedis();
        } catch (Exception var4) {
            log.error("同步[自动]所有角色权限发生错误：" + var4.getMessage(), var4);
        }

        log.info("同步[自动]所有角色权限完成,耗时：" + (System.currentTimeMillis() - s) + " ms");
    }
}
